package com.v512;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/** 
* @author  扶程星云 
* E-mail: fq@leanway.com.cn 
* @date 创建时间：Mar 17, 2016 4:17:20 PM 
* @version 1.0 
* @parameter  
* @since  
* @return  
*/
public class WebServer {
	public void serverStart(int port){
		try {
			ServerSocket serverSocket = new ServerSocket(port);
			while(true){
				Socket socket = serverSocket.accept();
				new Processor(socket).start();
			}
		} catch (IOException e) {

			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		int port=80;
		if (args.length==1){
			port = Integer.parseInt(args[0]);
		}
        new WebServer().serverStart(port);
	}

}
